<?php
class Core_Video
{
	/**
	 *
	 * @var Core_Video_Abstract
	 */
	private $_vendor;
	
	/**
	 *
	 * @param type $src
	 * @param array $options
	 * @return Core_Video 
	 */
	public static function factory($src,array $options = null)
	{
		if( !empty($options) )
		{
			$options = array_merge($options, array('src' => $src));
		}
		else
		{
			$options = array('src' => $src);
		}
		return new Core_Video(Core_Video_Abstract::VENDOR_YOUTUBE,$options);
	}
	
	protected function __construct($vendor = Core_Video_Abstract::VENDOR_YOUTUBE,array $options = null)
	{
		$vendorClass = 'Core_Video_' . ucfirst($vendor);
		$this->_vendor	= new $vendorClass($options);
	}
	
	public function getEmbededdCode($width = null, $height = null)
	{
		$code = $this->_vendor->getEmbededdCode($width, $height);
		return $code;
	}
	
	public function getThumbnailUrl()
	{
		return $this->_vendor->getThumbnailUrl();
	}
	
	public function getImageUrl()
	{
		return $this->_vendor->getImageUrl();
	}
	
	public function isExist()
	{
		return $this->_vendor->isExist();
	}
}